plugins {
    id "java"
    id "idea"
}

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

allprojects {
    apply plugin: "java"
    apply plugin: "idea"

    repositories {
        mavenCentral()
    }

    sourceCompatibility = JavaVersion.VERSION_21
    targetCompatibility = JavaVersion.VERSION_21

    idea {
        module {
            downloadJavadoc = true
            downloadSources = true
        }
    }

    jar {
        onlyIf { !sourceSets.main.allSource.files.isEmpty() }
    }

    compileJava.options.encoding = 'UTF-8'
    compileTestJava.options.encoding = 'UTF-8'
}

subprojects {
    dependencies {
        testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
        testImplementation "org.mockito:mockito-core:${mockitoVersion}"
        testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
        compileOnly "org.projectlombok:lombok:${lombokVersion}"
        annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
    }
    test {
        useJUnitPlatform()
    }
}
